<?php
// Cron Job //
?>
<?php
require ("config/databaseconfig.php");
$link = mysql_connect($host, $user, $password);
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
if (!mysql_select_db($dbname)) {
    die('Could not select database: ' . mysql_error());
}
$deletetime = time() - 900;
$deletetime2 = time() - 86400;
mysql_query("DELETE from Entries WHERE Expiry = 'min' AND Date < $deletetime");
mysql_query("DELETE from Entries WHERE Expiry = 'day' AND Date < $deletetime2");
mysql_query("SELECT * FROM '(' SELECT * FROM Entries ORDER BY time ASC ')' AS foo GROUP BY ID ORDER BY Date ASC");
mysql_close($link);
?>